import toast from "@/components/MyNewToast";
import { add } from "@/store/counterSlice";
import { show } from "@/store/toastSlice";
import React from "react";
import { useDispatch, useSelector } from "react-redux";

export default function Fast() {
  // 获取全局数据
  let count = useSelector((state: any) => {
    return state.countSlice.count;
  });

  // 操作全局数据
  const dispatch = useDispatch();

  return (
    <div>
      <p>Fast</p>
      <p>{count}</p>
      <p>
        <button onClick={() => dispatch(add())}>++</button>
      </p>
      <p>
        <button
          onClick={() =>
            dispatch(
              show({
                content: "弹出信息",
                type: "err",
              })
            )
          }
        >
          弹出
        </button>
      </p>
      <p>
        <button onClick={()=>toast('','')}>新弹出</button>
      </p>
    </div>
  );
}
